#include<iostream>
#include<unistd.h>
#include<sys/timerfd.h>

int main(){
    int timer1=timerfd_create(CLOCK_MONOTONIC,0);
    itimerspec time;
    time.it_value.tv_sec=1;
    time.it_value.tv_nsec=0;
    time.it_interval.tv_sec=3;
    time.it_interval.tv_nsec=0;

    timerfd_settime(timer1,0.,&time,NULL);

    uint64_t times=0;
    while(true){
        sleep(1);
        read(timer1,&times,sizeof(times));
        std::cout<<"times: "<<times<<std::endl;
        sleep(10);
        std::cout<<"times: "<<times<<std::endl;
    }
    return 0;
}